package jgl.vajra.operator.part.home.model;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import jgl.vajra.operator.bean.GrabListBean;
import jgl.vajra.operator.bean.GrabOrdersBean;
import jgl.vajra.operator.bean.ReceiptStatisticsBean;
import jgl.vajra.operator.bean.SpeechInfoBean;
import jgl.vajra.operator.manager.AccountManager;
import jgl.vajra.operator.netty.GrabOrderBean;
import jgl.vajra.operator.part.home.contract.GrabOrderContract;
import jgl.vajra.operator.widget.manager.RxJavaHttpManager;
import jgl.vajra.operator.widget.manager.retrofit.RetrofitJsonManager;
import jgl.vajra.operator.widget.utils.UIUtils;

public class GrabOrderModel extends GrabOrderContract.Model{
    @Override
    public Observable<SpeechInfoBean> getSpeechInfoData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getSpeechInfoData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<GrabOrderBean> getMessageOrderData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getMessageOrderData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<GrabOrdersBean> getGrabOrdersData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getGrabOrdersData(map, AccountManager.getInstance().getLoginData(UIUtils.getContext()).authorization)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<List<GrabListBean>> getGrabListData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getGrabListData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> removeGrabOrderData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().removeGrabOrderData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<List<ReceiptStatisticsBean>> getReceiptStatisticsData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getReceiptStatisticsData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }
}
